package self.hoy.demo.cloud.sentinel.conf;

import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import self.hoy.demo.cloud.sentinel.expt.ExceptionUtil;
import self.hoy.demo.cloud.sentinel.fall.EchoServiceFallback;

/**
 * @author 三共小不
 * @date 2021/7/6
 */
public class FeignConfiguration {
    @Bean
    public EchoServiceFallback echoServiceFallback() {
        return new EchoServiceFallback();
    }

    @Bean
    @SentinelRestTemplate(blockHandler = "handleException", blockHandlerClass = ExceptionUtil.class)
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
